<%@ include file="/common/taglibs.jsp"%>

<head>
    <title><fmt:message key="laundryRequestItem.title"/></title>
    <meta name="heading" content="<fmt:message key='laundryRequestItem.heading'/>"/>
    <meta name="menu" content="RoleAdminLaundry"/>

    <script type="text/javascript" src="<c:url value='/scripts/wz_tooltip.js'/>"></script>

    <script type="text/javascript">
        window.onload = function xx() {}
        function TooltipTxt(id) {
            var txt = '<fmt:message key="'+id+'"/>';
            return txt;
        }

        function changeAction() {
            document.laundryRequestItemForm.submit();
        }
    </script>
</head>
<s:hidden id="numberExcededID" value="%{getText('formatNumber.tooltip')}"/>
<s:hidden id="numberExcededID2" key="formatNumber.tooltip"/>

<s:form id="laundryRequestItemForm" name="laundryRequestItemForm" action="saveLaundryRequestItem" method="post" validate="true">
    <s:hidden key="laundryRequestItem.id" cssClass="text medium"/>

    <fieldset>
        <legend><fmt:message key="laundryRequestItem.availableClothes"/></legend>
        <s:select key="pantDesigns" list="pantDesigns" name="pantDesign.id"  listKey="id" listValue="datasModelAndMaterial"
                  headerKey="-1"  headerValue="-- Select --" onchange="changeAction()"/>

        <c:if test="${not empty seamStoragesAvailable}">
            <table class="table">
                <thead>
                    <tr>
                        <s:iterator value="modelSizes">
                            <th><s:property value="valueSize" /></th>
                        </s:iterator>
                    </tr>
                </thead>
                <tbody>
                    <tr class="<s:if test="#status.even">even</s:if><s:else>odd</s:else>" style="cursor: pointer;">
                        <s:iterator value="seamStoragesAvailable">
                            <td><s:property value="stock"/></td>
                        </s:iterator>
                    </tr>
                </tbody>
            </table>
        </c:if>
    </fieldset>
    <c:if test="${not empty quantities}">
        <fieldset>
            <legend><fmt:message key="laundryRequestItem.sendedClothes"/></legend>
            <table>
                <tr>
                    <td>
                        <s:select key="laundryTypes" list="laundryTypes" name="laundryRequestItem.laundryType.id"  listKey="id" listValue="type"
                                  onchange="changeAction()" headerKey="-1" headerValue="-- Select --" />
                    </td>
                    <td>
                        <s:textfield key="laundryRequestItem.unitPrice" required="true" cssClass="text medium"/>
                    </td>
                </tr>
            </table>
            <table class="table">
                <thead>
                    <tr>
                        <s:iterator value="modelSizes">
                            <th><s:property value="valueSize" /></th>
                        </s:iterator>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <s:iterator value="quantities" id="quantitiesL" status="status">
                            <td><s:textfield name="quantities" value="%{quantities[#status.index]}"  size="6">
                            </s:textfield></td>
                        </s:iterator>
                    </tr>
                </tbody>
            </table>
        </fieldset>
    </c:if>
    <li class="buttonBar bottom">
        <s:submit cssClass="button" method="saveButton" key="button.save" theme="simple"  />
        <c:if test="${not empty laundryRequestItem.id}">
            <s:submit cssClass="button" method="delete" key="button.delete" onclick="return confirmDelete('laundryRequestItem')" theme="simple"/>
        </c:if>
        <s:submit cssClass="button" method="cancel" key="button.cancel" theme="simple"/>
    </li>
</s:form>

<script type="text/javascript">
    Form.focusFirstElement($("laundryRequestItemForm"));
</script>